import { Component, type JSX, type ReactNode } from "react";

export function WithHoc1<T extends JSX.ElementType> (Com: T): T {
  return Com
}

export function WithHoc2<T extends React.ComponentType<Y>, Y> (Com: T, prop: React.ComponentProps<T>) {
  class Comp extends Component {
    public render(): ReactNode {
      return (
        <>
          <div>头部</div>
          <div><Com { ...prop } /></div>
          <div>尾部</div>
        </>
      )
    }
  }
  return Comp
}
